package com.union.core.dao.impl;

import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;

import org.apache.log4j.Logger;

import com.hnjowe.webdb.DBOperation;
import com.union.core.dao.IParamDao;
import com.union.core.model.Param;

/**
 * @
 * @projectname：cocotour
 * @packagename：com.duomi.core.dao.impl
 * @filename：ParamDaoImpl.java
 * @date：2012-5-27 上午12:04:52
 * @author: wangxiuwu
 */
public class ParamDaoImpl implements IParamDao{
	private DBOperation opera;
	private Param param;
	private static Logger log = Logger.getLogger(ParamDaoImpl.class.getName());
	
	
	public List<Param> queryList() {
		List<Param> paramList = new ArrayList<Param>();
		try {
			opera = new DBOperation();
			opera.transcationBegin();
			String sql = "select `id`,`param_name`,`param_code`,`param_type`,`effect_flag`,`order_no`,`remark`,`str1`,`str2`,`str3`,`create_userid`,`create_time` " +
					" from param where effect_flag=1 order by param_type,order_no ";
			opera.prepStatment(sql);
			ResultSet res = opera.executeQuery();
			while (res.next()) {
				param = new Param();
				param.setId(res.getLong(1));
				param.setParamName(res.getString(2));
				param.setParamCode(res.getString(3));
				param.setParamType(res.getString(4));
				param.setEffectTag(res.getBoolean(5));
				param.setOrderNo(res.getInt(6));
				param.setRemark(res.getString(7));
				param.setStr1(res.getString(8));
				param.setStr2(res.getString(9));
				param.setStr3(res.getString(10));
				paramList.add(param);
			}
		} catch (Exception e) {
			log.error(e);
		} finally {
			opera.closePres();
			opera.closeConn();
		}
		return paramList;
	}
}
